package com.lz.sports.ui.config

import android.os.Bundle
import com.lz.comm.BR
import com.lz.library.base.BaseActivity
import com.lz.sports.R
import com.lz.sports.adapter.ScoreRuleAdapter
import com.lz.sports.core.ProjectManager
import com.lz.sports.databinding.ActScoreRule2Binding
import com.lz.sports.vm.config.ScoreRuleViewModel

//评分规则
class ScoreRuleActivity : BaseActivity<ScoreRuleViewModel, ActScoreRule2Binding>() {

    private val adapter by lazy { ScoreRuleAdapter() }

    override fun getLayoutRes(): Int = R.layout.act_score_rule2

    override fun getVMVariableId(): Int = BR.vm

    override fun initData(savedState: Bundle?) {
        /*lifecycleScope.launch {
            arrayOf(binding.tvSave, binding.tvModel).click().collect {
                when (it.id) {
                    R.id.tv_model -> "现只支持取最优成绩模式".showToast()
                    R.id.tv_save -> {
                        viewModel.save()
                        R.string.saveSuccess.showToast()
                        finish()
                    }
                }
            }
        }
        ActivityScrollObserver.observe(this, binding.root)*/

        binding.rvList.adapter = adapter

        val configs = ProjectManager.currentExamProject?.projectConfig?.detailList
        if (configs != null && configs.isNotEmpty()) {
            adapter.setNewData(configs)
        }

    }
}